package com.sun.mybatisplus.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auth: syh
 * @Date: 2021/10/23 11:17
 * @Email: 1014170249@qq.com
 * @Desc: 不在能知，而在能行
 * 死信交换机
 */
@Configuration
public class DeadExchangeConfiguration {


    @Bean
    public DirectExchange directExchangeDead() {
        return new DirectExchange("dead_direct_exchange", true, false, null);
    }

    @Bean
    public Queue deadQueue() {
        return new Queue("dead_queue", true);
    }

    @Bean
    public Binding deadBinding(){
        return BindingBuilder.bind(deadQueue()).to(directExchangeDead()).with("dead");
    }
}
